package com.groupe_A.metier;

import java.util.Set;

/**
 * @author mohssine
 * @version 1.0
 * @created 30-avr.-2013 14:44:57
 */
public class Module  {

	private String codeModule;
	private Long idModule;
	private String libelle;
	
	public Module(){

	}
	
	public Module(String codeModule, String libelle) {
		this.codeModule = codeModule;
		this.libelle = libelle;
	}

	public String getCodeModule() {
		return codeModule;
	}
	public void setCodeModule(String codeModule) {
		this.codeModule = codeModule;
	}
	public String getLibelle() {
		return libelle;
	}
	public void setLibelle(String libelle) {
		this.libelle = libelle;
	}
	public Set<Matiere> getMatieres() {
		return matieres;
	}
	public void setMatieres(Set<Matiere> matieres) {
		this.matieres = matieres;
	}

	public Set<Matiere> matieres;

	public void addMatiere(Matiere matiere){
		matieres.add(matiere);
	}
	public void removeMatiere(Matiere matiere){
		matieres.remove(matiere);
	}

	public Long getIdModule() {
		return idModule;
	}
	public void setIdModule(Long idModule) {
		this.idModule = idModule;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((codeModule == null) ? 0 : codeModule.hashCode());
		result = prime * result
				+ ((idModule == null) ? 0 : idModule.hashCode());
		result = prime * result + ((libelle == null) ? 0 : libelle.hashCode());
		result = prime * result
				+ ((matieres == null) ? 0 : matieres.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Module other = (Module) obj;
		if (codeModule == null) {
			if (other.codeModule != null)
				return false;
		} else if (!codeModule.equals(other.codeModule))
			return false;
		if (idModule == null) {
			if (other.idModule != null)
				return false;
		} else if (!idModule.equals(other.idModule))
			return false;
		if (libelle == null) {
			if (other.libelle != null)
				return false;
		} else if (!libelle.equals(other.libelle))
			return false;
		if (matieres == null) {
			if (other.matieres != null)
				return false;
		} else if (!matieres.equals(other.matieres))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Module [codeModule=" + codeModule + ", idModule=" + idModule
				+ ", libelle=" + libelle + ", matieres=" + matieres + "]";
	}

	
}